Optimal. Leaf size=94 \[ a^2 x-2 a b d \cos (c) \text{CosIntegral}\left (\frac{d}{x}\right )+2 a b d \sin (c) \text{Si}\left (\frac{d}{x}\right )+2 a b x \sin \left (c+\frac{d}{x}\right )-b^2 d \sin (2 c) \text{CosIntegral}\left (\frac{2 d}{x}\right )-b^2 d \cos (2 c) \text{Si}\left (\frac{2 d}{x}\right )+b^2 x \sin ^2\left (c+\frac{d}{x}\right ) \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.22635, antiderivative size = 94, normalized size of antiderivative = 1., number of steps used = 12, number of rules used = 8, integrand size = 14, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.571, Rules used = {3361, 3317, 3297, 3303, 3299, 3302, 3313, 12} \[ a^2 x-2 a b d \cos (c) \text{CosIntegral}\left (\frac{d}{x}\right )+2 a b d \sin (c) \text{Si}\left (\frac{d}{x}\right )+2 a b x \sin \left (c+\frac{d}{x}\right )-b^2 d \sin (2 c) \text{CosIntegral}\left (\frac{2 d}{x}\right )-b^2 d \cos (2 c) \text{Si}\left (\frac{2 d}{x}\right )+b^2 x \sin ^2\left (c+\frac{d}{x}\right ) \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3361
Rule 3317
Rule 3297
Rule 3303
Rule 3299
Rule 3302
Rule 3313
Rule 12
Rubi steps
\begin{align*} \int \left (a+b \sin \left (c+\frac{d}{x}\right )\right )^2 \, dx &=-\operatorname{Subst}\left (\int \frac{(a+b \sin (c+d x))^2}{x^2} \, dx,x,\frac{1}{x}\right )\\ &=-\operatorname{Subst}\left (\int \left (\frac{a^2}{x^2}+\frac{2 a b \sin (c+d x)}{x^2}+\frac{b^2 \sin ^2(c+d x)}{x^2}\right ) \, dx,x,\frac{1}{x}\right )\\ &=a^2 x-(2 a b) \operatorname{Subst}\left (\int \frac{\sin (c+d x)}{x^2} \, dx,x,\frac{1}{x}\right )-b^2 \operatorname{Subst}\left (\int \frac{\sin ^2(c+d x)}{x^2} \, dx,x,\frac{1}{x}\right )\\ &=a^2 x+2 a b x \sin \left (c+\frac{d}{x}\right )+b^2 x \sin ^2\left (c+\frac{d}{x}\right )-(2 a b d) \operatorname{Subst}\left (\int \frac{\cos (c+d x)}{x} \, dx,x,\frac{1}{x}\right )-\left (2 b^2 d\right ) \operatorname{Subst}\left (\int \frac{\sin (2 c+2 d x)}{2 x} \, dx,x,\frac{1}{x}\right )\\ &=a^2 x+2 a b x \sin \left (c+\frac{d}{x}\right )+b^2 x \sin ^2\left (c+\frac{d}{x}\right )-\left (b^2 d\right ) \operatorname{Subst}\left (\int \frac{\sin (2 c+2 d x)}{x} \, dx,x,\frac{1}{x}\right )-(2 a b d \cos (c)) \operatorname{Subst}\left (\int \frac{\cos (d x)}{x} \, dx,x,\frac{1}{x}\right )+(2 a b d \sin (c)) \operatorname{Subst}\left (\int \frac{\sin (d x)}{x} \, dx,x,\frac{1}{x}\right )\\ &=a^2 x-2 a b d \cos (c) \text{Ci}\left (\frac{d}{x}\right )+2 a b x \sin \left (c+\frac{d}{x}\right )+b^2 x \sin ^2\left (c+\frac{d}{x}\right )+2 a b d \sin (c) \text{Si}\left (\frac{d}{x}\right )-\left (b^2 d \cos (2 c)\right ) \operatorname{Subst}\left (\int \frac{\sin (2 d x)}{x} \, dx,x,\frac{1}{x}\right )-\left (b^2 d \sin (2 c)\right ) \operatorname{Subst}\left (\int \frac{\cos (2 d x)}{x} \, dx,x,\frac{1}{x}\right )\\ &=a^2 x-2 a b d \cos (c) \text{Ci}\left (\frac{d}{x}\right )-b^2 d \text{Ci}\left (\frac{2 d}{x}\right ) \sin (2 c)+2 a b x \sin \left (c+\frac{d}{x}\right )+b^2 x \sin ^2\left (c+\frac{d}{x}\right )+2 a b d \sin (c) \text{Si}\left (\frac{d}{x}\right )-b^2 d \cos (2 c) \text{Si}\left (\frac{2 d}{x}\right )\\ \end{align*}
Mathematica [A] time = 0.144822, size = 105, normalized size = 1.12 \[ \frac{1}{2} \left (2 a^2 x-4 a b d \cos (c) \text{CosIntegral}\left (\frac{d}{x}\right )+4 a b d \sin (c) \text{Si}\left (\frac{d}{x}\right )+4 a b x \sin \left (c+\frac{d}{x}\right )-2 b^2 d \sin (2 c) \text{CosIntegral}\left (\frac{2 d}{x}\right )-2 b^2 d \cos (2 c) \text{Si}\left (\frac{2 d}{x}\right )-b^2 x \cos \left (2 \left (c+\frac{d}{x}\right )\right )+b^2 x\right ) \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.024, size = 110, normalized size = 1.2 \begin{align*} -d \left ( -{\frac{{a}^{2}x}{d}}+2\,ab \left ( -{\frac{x}{d}\sin \left ( c+{\frac{d}{x}} \right ) }-{\it Si} \left ({\frac{d}{x}} \right ) \sin \left ( c \right ) +{\it Ci} \left ({\frac{d}{x}} \right ) \cos \left ( c \right ) \right ) -{\frac{{b}^{2}x}{2\,d}}-{\frac{{b}^{2}}{4} \left ( -2\,{\frac{x}{d}\cos \left ( 2\,{\frac{d}{x}}+2\,c \right ) }-4\,{\it Si} \left ( 2\,{\frac{d}{x}} \right ) \cos \left ( 2\,c \right ) -4\,{\it Ci} \left ( 2\,{\frac{d}{x}} \right ) \sin \left ( 2\,c \right ) \right ) } \right ) \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [C] time = 1.22124, size = 185, normalized size = 1.97 \begin{align*} -{\left ({\left ({\left ({\rm Ei}\left (\frac{i \, d}{x}\right ) +{\rm Ei}\left (-\frac{i \, d}{x}\right )\right )} \cos \left (c\right ) -{\left (-i \,{\rm Ei}\left (\frac{i \, d}{x}\right ) + i \,{\rm Ei}\left (-\frac{i \, d}{x}\right )\right )} \sin \left (c\right )\right )} d - 2 \, x \sin \left (\frac{c x + d}{x}\right )\right )} a b - \frac{1}{2} \,{\left ({\left ({\left (-i \,{\rm Ei}\left (\frac{2 i \, d}{x}\right ) + i \,{\rm Ei}\left (-\frac{2 i \, d}{x}\right )\right )} \cos \left (2 \, c\right ) +{\left ({\rm Ei}\left (\frac{2 i \, d}{x}\right ) +{\rm Ei}\left (-\frac{2 i \, d}{x}\right )\right )} \sin \left (2 \, c\right )\right )} d + x \cos \left (\frac{2 \,{\left (c x + d\right )}}{x}\right ) - x\right )} b^{2} + a^{2} x \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 1.55331, size = 373, normalized size = 3.97 \begin{align*} -b^{2} x \cos \left (\frac{c x + d}{x}\right )^{2} - b^{2} d \cos \left (2 \, c\right ) \operatorname{Si}\left (\frac{2 \, d}{x}\right ) + 2 \, a b d \sin \left (c\right ) \operatorname{Si}\left (\frac{d}{x}\right ) + 2 \, a b x \sin \left (\frac{c x + d}{x}\right ) +{\left (a^{2} + b^{2}\right )} x -{\left (a b d \operatorname{Ci}\left (\frac{d}{x}\right ) + a b d \operatorname{Ci}\left (-\frac{d}{x}\right )\right )} \cos \left (c\right ) - \frac{1}{2} \,{\left (b^{2} d \operatorname{Ci}\left (\frac{2 \, d}{x}\right ) + b^{2} d \operatorname{Ci}\left (-\frac{2 \, d}{x}\right )\right )} \sin \left (2 \, c\right ) \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F] time = 0., size = 0, normalized size = 0. \begin{align*} \int \left (a + b \sin{\left (c + \frac{d}{x} \right )}\right )^{2}\, dx \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F] time = 0., size = 0, normalized size = 0. \begin{align*} \int{\left (b \sin \left (c + \frac{d}{x}\right ) + a\right )}^{2}\,{d x} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]